<template>
  <div id="orderDetails">
    <div class="navigation_bar" :style="navStyleObj">
      <el-card :body-style="{padding: '15px'}" shadow="never" style="overflow-y: auto"
               :style="nav_height">
        <div>
          <ul class="nav_list">
            <div class="nav_fixing" :style="{top:navTop+'px'}">
              <i style="color: #fff" class="el-icon-caret-right"></i>
            </div>
            <li class="nav_list_item" ref="tabsItem" v-for="(item,index) in navList" :key="item.index"
                @click="onChange(index)">
              <div class="item_text overflow"
                   :title="item.name"
                   :style="{color:index === navActive ? '#F1B901' :''}">{{ item.name }}
              </div>
            </li>
          </ul>
        </div>
      </el-card>
      <el-row :gutter="24" style="text-align: center;margin: 0">
        <!--        <el-col :span="24" style="margin-top: 15px">-->
        <!--          <el-button style="width: 100%" type="primary" @click="navBtn('jump')"><span>-->
        <!--                    {{ $t('跳过') }}-->
        <!--                  </span></el-button>-->
        <!--        </el-col>-->
        <el-col :span="24" style="margin-top: 15px" v-show="getAuth[84]">
          <el-button style="width: 100%" type="primary" @click="navBtn('report')"><span>
            {{ $t('上报黑名单') }}
          </span></el-button>
        </el-col>
        <el-col :span="24" style="margin-top: 15px" v-show="getAuth[85]">
          <el-button style="width: 100%" type="primary" @click="navBtn('examine')"><span>
            {{ $t('审核') }}
          </span></el-button>
        </el-col>
        <el-col :span="24" style="margin-top: 15px" v-show="getAuth[83] || getAuth[983] ">
          <el-button style="width: 100%" type="primary" @click="navBtn('remark')"><span>
            {{ $t('备注') }}
          </span></el-button>
        </el-col>
      </el-row>
    </div>
    <!--       上报黑名单-->
    <Dialog @cancel="visibleReport= false" @close="clearForm" @confirm="confirm" :visible.sync="visibleReport"
            :title="$t('上报黑名单')"
            :confirm-loading="dialogLoading">
      <el-form ref="reportForm" :model="reportForm" label-width="50px">
        <el-form-item prop="cause" :label="$t('原因')"
                      :rules="[ { required: true, message: $t('不能为空')} ]">
          <el-select v-model="reportForm.cause" @change="selectReportCause">
            <el-option v-for="item in reportSelectList" :key="item.key" :value="item.key"
                       :label="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item prop="remark" :label="$t('备注')"
                      :required="reportForm.isRemarks === 1"
                      :rules=" reportForm.isRemarks === 1 ?[ { required: true, message: $t('不能为空'),trigger:'blur'} ] : []">
          <el-input type="textarea" :placeholder="$t('请输入上报原因')" v-model="reportForm.remark" :rows="4"></el-input>
        </el-form-item>
      </el-form>
    </Dialog>
    <!--       审核-->
    <Dialog @cancel="visibleExamine= false" @close="clearForm" @confirm="confirm" :visible.sync="visibleExamine"
            :title="$t('审核')"
            :confirm-loading="dialogLoading"
    >
      <el-form ref="examineForm" :model="examineForm" :rules="examinRules"
               label-width="80px">
        <el-form-item :label="$t('结果')" prop="approvalResult">
          <el-select v-model="examineForm.approvalResult" @change="changeResult" style="width: 100%">
            <el-option :label="$t('拒绝')" :value="1"></el-option>
            <el-option :label="$t('通过')" :value="2"></el-option>
            <el-option :label="$t('订单关闭')" :value="3"></el-option>
          </el-select>
        </el-form-item>
        <div v-if="examineForm.approvalResult !== 2">
          <el-form-item :label="$t('原因')" prop="cause1">
            <el-select v-model="examineForm.cause1" style="width: 100%" @change="reasonSelect">
              <el-option v-for="item in examinReasoneList" :label="item.value" :value="item.key"
                         :key="item.key"></el-option>
            </el-select>
            <div style="margin-top: 10px" v-if="examineTagsList.length > 0">
              <el-tag v-for="item in examineTagsList" :effect="item.key === examineForm.cause2 ? 'dark' : 'plain'"
                      :key="item.key"
                      @click="examineTagsClick(item)" :label="item.key" style="margin: 0 10px 10px 0;cursor: pointer">
                {{ item.value }}
              </el-tag>
            </div>
          </el-form-item>
        </div>
        <div v-if="examineForm.approvalResult === 2 && getAuth[623]">
          <el-form-item label-width="110px"
                        :label="$t('审批周期金额')"
                        prop="approvalAmount"
          >
            <el-row :gutter="24" style="margin: 0" v-if="getAuth[1060]">
              <el-col :span="11">
                <el-select style="width: 100%" :placeholder="$t('请选择周期')" v-model="examineForm.loanTerm"
                           @change="loanTermChange">
                  <el-option v-for="item in selectTermList" :value="item" :key="item"
                             :label="item.loanTerm"></el-option>
                </el-select>
              </el-col>
              <el-col :span="1" style="text-align: center;line-height: 32px">-</el-col>
              <el-col :span="11">
                <el-select style="width: 100%" :placeholder="$t('请选择金额')" v-model="examineForm.approvalAmount"
                           @change="approvalAmountChange">
                  <el-option v-for="item in loanAmountSelect" :value="item.loanAmount" :key="item.loanAmount"
                             :label="item.loanAmount"></el-option>
                </el-select>
              </el-col>
            </el-row>
            <el-row :gutter="24" style="margin: 0" v-else>
              <el-col :span="24">
                <el-select style="width: 100%" v-model="examineForm.approvalAmount" @change="approvalAmountChange">
                  <el-option v-for="item in loanAmountSelect" :value="item.loanAmount" :key="item.loanAmount"
                             :label="item.loanAmount"></el-option>
                </el-select>
              </el-col>
            </el-row>

          </el-form-item>
        </div>
        <el-form-item label=" " v-if="examineForm.approvalResult === 2 && getAuth[623]" label-width="110px">
          <div style="margin-bottom: 15px">
            <label style="width: 80px">{{ $t('利息') }}：</label>
            <span>{{ loanInfo.interest }}</span>
          </div>
          <div style="margin-bottom: 15px">
            <label style="width: 80px">{{ $t('服务费') }}：</label>
            <span>{{ loanInfo.serviceFee }}</span>
          </div>
          <div style="margin-bottom: 15px">
            <label style="width: 80px">{{ $t('计息方式') }}：</label>
            <span>{{ loanInfo.type }}</span>
          </div>
        </el-form-item>
        <el-form-item :label="$t('备注')" prop="remarks"
                      :rules="examineForm.isRequiredRemark === 1 ?  [{required: true, message: this.$t('不能为空')}] : []">
          <el-input type="textarea" v-model="examineForm.remarks" :rows="4"></el-input>
        </el-form-item>
        <el-form-item :label="$t('上传图片')" prop="imgUrl">
          <el-upload
              ref="upload"
              list-type="picture-card"
              :class="{hide:hideUpload}"
              action="#"
              accept=".jpg,.jpeg,.png,.gif,.bmp,.JPG,.JPEG"
              :on-remove="handleRemove"
              :limit="5"
              :http-request="uploadChange">
            <i slot="default" v-show="examineFileList.length< 5" class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>

      </el-form>

    </Dialog>
    <!--       备注-->
    <Dialog @cancel="visibleRemark= false" @close="clearForm" @confirm="confirm" :visible.sync="visibleRemark"
            :title="$t('备注')"
            :confirm-loading="dialogLoading">
      <el-form ref="remarkForm" :model="remarkForm" :rules="remarkRules" label-width="80px">
        <el-form-item :label="$t('备注')" prop="details">
          <el-input type="textarea" v-model="remarkForm.details" :rows="5"></el-input>
        </el-form-item>
        <el-form-item :label="$t('上传图片')" prop="imageUrl">
          <el-upload
              ref="upload"
              list-type="picture-card"
              :class="{hide:hideUpload}"
              action="#"
              accept=".jpg,.jpeg,.png,.gif,.bmp,.JPG,.JPEG"
              :on-remove="handleRemove"
              :limit="5"
              :http-request="uploadChange">
            <i slot="default" class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
      </el-form>
    </Dialog>

    <!-- 折叠面板-->
    <div class="collapse">
      <el-collapse v-model="callapse">
        <el-collapse-item v-for="item in navList" :key="item.item" class="collapse_item" style="margin-bottom: 15px;"
                          :name="item.id" :id="item.webUrl">
          <template slot="title">
            <div class="collapse_title">
              {{ item.name }}
            </div>
          </template>
          <div>
            <div class="collapse_content">
              <component :is="item.webUrl" :routesQuery="routesQuery" :childPermiss="item.children"></component>
            </div>
          </div>
        </el-collapse-item>
      </el-collapse>
    </div>
  </div>
</template>

<script>
// 基本信息
import baseInfo from "./component/orderPanel/baseInfo";
// 身份证信息
import identityInfo from "./component/orderPanel/identityInfo";
// 审核信息
import auditInformation from "./component/orderPanel/auditInformation";
// 银行卡信息
import bankCardInfo from "./component/orderPanel/bankCardInfo";
// 手机通话记录
import callLog from "./component/orderPanel/callLog";
// 运营商通话记录top50
import callrecordTop50 from "./component/orderPanel/callrecordTop50";
// 本地通话记录top50
import localCallLogTop50 from './component/orderPanel/localCallLogTop50'
// 收入消费证明
import consumptionDetails from "./component/orderPanel/consumptionDetails";
// 详细通话记录
import detailedRecord from "./component/orderPanel/detailedRecord";
// 用户app
import loanApp from "./component/orderPanel/loanApp";
// 贷款记录
import loanRecords from "./component/orderPanel/loanRecords";
// 有效贷款统计
import loanStatistics from "./component/orderPanel/loanStatistics";
// 通讯录
import mailList from "./component/orderPanel/mailList";
// 运营商报告
import operatorReport from "./component/orderPanel/operatorReport";
// 风险报告
import riskReporting from "./component/orderPanel/riskReporting";
// 短信记录
import smsRecord from "./component/orderPanel/smsRecord";
// 紧急联系人
import urgentContacts from "./component/orderPanel/urgentContacts";
// 工作信息
import workInfo from "./component/orderPanel/workInfo";
// 机审报告
import machineReview from "./component/orderPanel/machineReview";
// 共库报告
import querySharedLibrary from './component/orderPanel/querySharedLibrary'
// 多头报告
import dtOldSource from './component/orderPanel/dtOldSource'
// 虚拟卡生成
import repaymentCode from "./component/orderPanel/repaymentCode";
// 印尼还款码链接
import yinniRepayment from "./component/orderPanel/yinniRepayment";
// 税卡信息
import postInfo from "./component/orderPanel/postInfo";
// 话费充值记录
import phoneBillRecord from "./component/orderPanel/phoneBillRecord";
import {debounce} from "@/utils/tools";
import eventBus from "@/utils/eventBus";
import {
  selectBlacklistCause,
  selectAuditCause,
  uploadTrustInfo,
  approvalReview,
  approvalLoanTerm,
  approvalAmount,
  addTrustInfo,
  addBlacklist
} from '@/api/order'

export default {
  props: ['panePermiss','routesQuery'],
  data() {
    return {
      navActive: 1,
      navList: [],
      navTop: 0,
      callapse: [],
      navStyleObj: {},
      scroll: 0,
      visible: {
        isShow: false,
        type: '',
        title: ''
      },
      dialogLoading: false,
      reportForm: {},
      examineForm: {},
      remarkForm: {},
      tabs_top: 100,
      getAuth: {},
      approvalProductSelect: [],
      allExamineList: [],
      examinReasoneList: [],
      examineTagsList: [],
      reportSelectList: [],
      examineFileList: [],
      remarkFileList: [],
      hideUpload: false,
      loanAmountSelect: [],
      selectTermList: [],
      loanInfo: {
        overdueInterest: 0,
        interest: 0,
        serviceFee: 0,
        type: null
      },
      examinRules: {
        approvalAmount: [
          {
            required: true, validator: (rule, value, callback) => {
              const {approvalAmount, loanTerm} = this.examineForm
              if (this.getAuth[1060] && (!loanTerm || !approvalAmount)) {
                return callback(new Error(this.$t('不能为空')))
              } else if (!approvalAmount) {
                return callback(new Error(this.$t('不能为空')))
              } else {
                return callback()
              }
            }
          }
        ],
        cause1: [
          {
            required: true, message: this.$t('不能为空')
          }
        ],
        approvalResult: [
          {required: true, message: this.$t('不能为空')}
        ],
      },
      remarkRules: {
        details: [{required: true, message: this.$t('不能为空')}]
      },
      visibleRemark: false,
      visibleExamine: false,
      visibleReport: false

    }
  },
  mounted() {
    window.addEventListener('scroll', this.onScroll)
    this.getList()
  },
  methods: {
    async getList() {
      const callapseItem = []
      const data = this.panePermiss.map(item => {
        // weburl匹配前端路径
        if (this.components[item.webUrl]) {
          callapseItem.push(item.id)
        } else {
          // 按钮显示隐藏
          this.getAuth[item.id] = item.url
          if (item.children && item.children.length) {
            item.children.forEach(key => {
              this.getAuth[key.id] = key.url
            })
          }
        }
        return item
      })
      // 锚点列表
      this.navList = data.filter(item => item.webUrl)
      // 级联菜单id
      this.callapse = callapseItem
      if (this.navList.length !== 0) {
        this.$nextTick(() => {
          this.tabs_top = document.getElementById('orderDetails').getBoundingClientRect().top
          this.activeAnchor(0)
        })
      }
    },
    handleClick(value) {
      this.activeName = value.type
    },
    onScroll: debounce(function () {
      const navContents = document.querySelectorAll('.collapse_item')
      const offsetTopArr = []
      navContents.forEach(item => {
        offsetTopArr.push(item.offsetTop)
      })
      const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
      let index = 0
      for (let n = 0; n < offsetTopArr.length; n++) {
        if (scrollTop >= offsetTopArr[n] - 100) {
          index = n
        }
      }
      this.activeAnchor(index)
    }, 50),
    onChange(index) {
      this.activeAnchor(index)
      this.loadScroll(index)
    },
    activeAnchor(index) {
      let scrollTop = document.documentElement.scrollTop || document.body.scrollTop
      const navItem = this.$refs.tabsItem[index]
      this.navTop = navItem.offsetTop + 5
      this.navActive = index
      this.navStyleObj = scrollTop > 186 ? {top: 0} : {top: this.tabs_top + 'px'}
    },
    // 瞄点定位
    loadScroll(index) {
      let scrollTop = document.documentElement.scrollTop || document.body.scrollTop
      let targetoffset = document.querySelectorAll('.collapse_item')[index].offsetTop
      const STEP = 120
      if (scrollTop >= targetoffset) {
        // 上滑
        const down = () => {
          if (scrollTop > targetoffset) {
            if (scrollTop - targetoffset >= STEP) {
              scrollTop -= STEP
            } else {
              scrollTop = targetoffset
            }
            requestAnimationFrame(down)
            document.body.scrollTop = scrollTop
            document.documentElement.scrollTop = scrollTop
          }
        }
        down()
      } else {
        // 下滑
        const up = () => {
          if (scrollTop < targetoffset) {
            if (targetoffset - scrollTop >= STEP) {
              scrollTop += STEP
            } else {
              scrollTop = targetoffset
            }
            requestAnimationFrame(up)
            document.body.scrollTop = scrollTop
            document.documentElement.scrollTop = scrollTop
          }
        }
        up()
      }
    },

    async navBtn(type) {
      let title = ''
      if (type === 'report') {
        const res = await selectBlacklistCause()
        if (res.code === 1) {
          this.reportSelectList = res.data
        }
        this.visibleReport = true
        title = this.$t('上报黑名单')
      } else if (type === 'examine') {
        title = this.$t('审核')
        this.visibleExamine = true
      } else {
        title = this.$t('备注')
        this.visibleRemark = true
      }
      this.visible = {
        type: type,
        title: title,
      }
    },
    // 回显审核金额
    async changeResult(value) {
      // 审核结果通过 获取金额下拉
      if (value === 2) {
        this.examineForm.cause1 = null
        this.examineForm.cause2 = null
        const {orderId} = this.routesQuery
        // 有审核周期权限获取周期下拉选择 否则直接回显周期和金额
        if (this.getAuth[623] && !this.getAuth[1060]) {
          const res = await approvalAmount({
            loanRecordId: orderId
          })
          if (res.code === 1 && res.data) {
            const {loanProducts, approvalAmount} = res.data
            this.loanAmountSelect = loanProducts
            this.$set(this.examineForm, 'approvalAmount', approvalAmount)
            const loanInfo = this.loanAmountSelect.find(item => item.loanAmount === approvalAmount)
            if (loanInfo) {
              // 回显贷款信息
              this.loanBack(approvalAmount, loanInfo)
            }
          }
        } else if (this.getAuth[1060]) {
          // 获取天数
          const loanTermRequest = approvalLoanTerm({loanRecordId: orderId})
          // 获取金额
          const loanProductRequest = approvalAmount({loanRecordId: orderId})
          Promise.all([loanTermRequest, loanProductRequest]).then(res => {
            const [loanTermRes, amountRes] = res
            if (loanTermRes.code === 1) {
              const {loanTerm, loanTermS} = loanTermRes.data
              this.$set(this.examineForm, 'loanTerm', loanTerm)
              this.selectTermList = loanTermS
            }
            if (amountRes.code === 1) {
              const {approvalAmount, loanProducts} = amountRes.data
              this.$set(this.examineForm, 'approvalAmount', approvalAmount)
              this.loanAmountSelect = loanProducts
              const loanInfo = this.loanAmountSelect.find(item => item.loanAmount === approvalAmount)
              if (loanInfo) {
                // 回显贷款信息
                this.loanBack(approvalAmount, loanInfo)
              }
            }
          })
        }
      } else {
        if (this.examineForm.cause1) this.examineForm.cause1 = null
        if (this.examineForm.cause2) this.examineForm.cause2 = null
        this.examineTagsList = []
        const res = await selectAuditCause()
        if (res.code === 1) {
          const filterList = [...res.data].filter(item => {
            return item.code === 0 && item.orderStatus === value
          })
          this.allExamineList = res.data
          this.examinReasoneList = filterList
        }
      }
    },
    // 去除重复天数
    removalTerm(arr) {
      const obj = {}
      const res = []
      arr.forEach(item => {
        if (!obj[item.loanTerm]) {
          res.push(item)
          obj[item.loanTerm] = true
        }
      })
      return res
    },
    // 审批周期下拉
    async loanTermChange(value) {
      if (this.examineForm.approvalAmount) {
        this.$set(this.examineForm, 'approvalAmount', null)
      }
      const {orderId} = this.routesQuery
      const res = await approvalAmount({
        loanTerm: value,
        loanRecordId: orderId
      })
      if (res.code === 1) {
        const {loanProducts} = res.data
        if (this.examineForm.approvalAmount) this.$set(this.examineForm, 'approvalAmount', null)
        this.loanAmountSelect = loanProducts
      }
      this.loanInfo = {
        overdueInterest: 0,
        interest: 0,
        serviceFee: 0,
        type: null
      }
    },
    // 金额下拉
    approvalAmountChange(value) {
      const loanInfo = this.loanAmountSelect.filter(item => item.loanAmount === value)[0]
      this.loanBack(value, loanInfo)
    },
    /**
     * 回显贷款信息
     */
    loanBack(value, loanInfo) {
      const {loanInterest, loanPoundage, refundWay, interestType, poundageType} = loanInfo
      // const overdueInterest = parseFloat(value * overdueFine).toFixed(2)
      const interest = interestType === 1 ? parseFloat(value * loanInterest).toFixed(2) : parseFloat(loanInterest)
      const serviceFee = poundageType === 1 ? parseFloat(value * loanPoundage).toFixed(2) : parseFloat(loanPoundage)
      const type = refundWay === 1 ? this.$t('先扣除手续费') : refundWay === 2 ? this.$t('先扣除手续费和利息') : this.$t('到期计算')
      this.loanInfo = {
        interest, serviceFee, type
      }
    },
    // 原因下拉
    reasonSelect(key) {
      const type = this.allExamineList.filter(item => item.key === key)
      const list = this.allExamineList.filter(item => {
        return item.code !== 0 && item.type === type[0].type && item.orderStatus === type[0].orderStatus
      })
      this.examineTagsList = list
      this.examineForm.cause2 = list.length !== 0 ? list[0].key : null
      // 选择其他备注必填
      this.examineForm.isRequiredRemark = type[0].isRemark
      if (type[0].isRemark === 1) {
        this.$refs.examineForm.validateField('remarks')
      } else {
        this.$refs.examineForm.clearValidate('remarks')
      }
    },
    examineTagsClick({key, isRemark}) {
      this.examineForm = {
        ...this.examineForm,
        cause2: key,
        isRequiredRemark: isRemark
      }
      // 选择其他备注必填
      if (isRemark === 1) {
        this.$refs.examineForm.validateField(['remarks'])
      } else {
        this.$refs.examineForm.clearValidate(['remarks'])
      }
    },
    // 上报黑名单下拉
    selectReportCause(value) {
      if (value === 'OTHER') {
        this.reportForm.isRemarks = 1
      } else {
        this.reportForm.isRemarks = 0
      }
    },

    async uploadChange(data) {
      const formData = new FormData()
      formData.append('file', data.file)
      const res = await uploadTrustInfo(formData)
      if (res.code === 1) {
        if (this.visible.type === 'examine') {
          this.examineFileList.push({
            url: res.data,
            // 保存上传时间戳 删除用
            time: data.file.uid
          })
          this.hideUpload = this.examineFileList.length >= 5
        } else {
          this.remarkFileList.push({
            url: res.data,
            // 保存上传时间戳 删除用
            time: data.file.uid
          })
          this.hideUpload = this.remarkFileList.length >= 5
        }
      }
    },
    // 删除上传图片
    handleRemove(file) {
      if (this.visible.type === 'examine') {
        for (let i = 0; i < this.examineFileList.length; i++) {
          if (this.examineFileList[i].time === file.uid) {
            this.examineFileList.splice(i, 1)
            this.hideUpload = this.examineFileList.length >= 5
          }
        }
      } else {
        for (let i = 0; i < this.remarkFileList.length; i++) {
          if (this.remarkFileList[i].time === file.uid) {
            this.remarkFileList.splice(i, 1)
            this.hideUpload = this.remarkFileList.length >= 5
          }
        }
      }
    },
    confirm() {
      const type = this.visible.type
      const form = this.$refs[`${type}Form`]
      form.validate(v => {
        if (v) {
          const {userStubId, orderId, approvalId, userId} =this.routesQuery
          this.dialogLoading = true
          if (type === 'report') {
            // 上报黑名单
            this.submitReport(userStubId)
          } else if (type === 'examine') {
            // 审核
            this.submitExamine(approvalId)
          } else if (type === 'remark') {
            // 备注
            this.submitRemark(userId, orderId)
          }
        }
      })
    },
    clearForm() {
      this.$refs[`${this.visible.type}Form`].resetFields()
      this[`${this.visible.type}Form`] = {}
      // 清空文件列表
      this.allExamineList = []
      this.examinReasoneList = []
      this.examineTagsList = []
      this.reportSelectList = []
      this.examineFileList = []
      this.remarkFileList = []
      if (this.$refs.upload) {
        this.$refs.upload.clearFiles()
      }
    },
    // 上报黑名单
    async submitReport(id) {
      const params = {
        userStubId: parseInt(id),
        ...this.reportForm
      }
      const res = await addBlacklist(params)
      if (res.code === 1) {
        eventBus.$emit('examineSuccess', true)
        this.$message.success(this.$t('操作成功'))
        this.clearForm()
        this.dialogLoading = false
        this.visible.isShow = false
        this.$router.back()
      } else {
        this.dialogLoading = false
      }
    },
    // 审核
    async submitExamine(id) {
      const params = {
        approvalId: parseInt(id),
        ...this.examineForm
      }
      if (this.examineFileList.length) {
        params.imgUrl = this.examineFileList.map(item => item.url).join(',')
      }
      const res = await approvalReview(params)
      if (res.code === 1) {
        eventBus.$emit('examineSuccess', true)
        this.$message.success(this.$t('操作成功'))
        this.clearForm()
        this.dialogLoading = false
        this.visible.isShow = false
        this.$router.back()
      } else {
        this.dialogLoading = false
      }
    },
    // 备注
    async submitRemark(id, orderId) {
      const params = {
        loanRecordId: orderId,
        userId: parseInt(id),
        ...this.remarkForm
      }
      if (this.remarkFileList.length) {
        params.imgUrl = this.remarkFileList.map(item => item.url).join(',')
      }
      const res = await addTrustInfo(params)
      if (res.code === 1) {
        eventBus.$emit('examineSuccess', true)
        this.$message.success(this.$t('操作成功'))
        this.clearForm()
        this.dialogLoading = false
        this.visible.isShow = false
        this.$router.back()
      } else {
        this.dialogLoading = false
      }
    },
  },
  components: {
    baseInfo,
    identityInfo,
    auditInformation,
    bankCardInfo,
    callLog,
    callrecordTop50,
    consumptionDetails,
    detailedRecord,
    loanApp,
    loanRecords,
    loanStatistics,
    mailList,
    operatorReport,
    riskReporting,
    smsRecord,
    urgentContacts,
    workInfo,
    machineReview,
    localCallLogTop50,
    querySharedLibrary,
    dtOldSource,
    repaymentCode,
    yinniRepayment,
    postInfo,
    phoneBillRecord
  },
  computed: {
    components() {
      // 后台url对象匹配前端组件
      return {
        'baseInfo': 'baseInfo',
        'identityInfo': 'identityInfo',
        'riskReporting': 'riskReporting',
        'loanApp': 'loanApp',
        'workInfo': 'workInfo',
        'bankCardInfo': 'bankCardInfo',
        'consumptionDetails': 'consumptionDetails',
        'urgentContacts': 'urgentContacts',
        'mailList': 'mailList',
        'smsRecord': 'smsRecord',
        'callLog': 'callLog',
        'operatorReport': 'operatorReport',
        'detailedRecord': 'detailedRecord',
        'callrecordTop50': 'callrecordTop50',
        'localCallLogTop50': 'localCallLogTop50',
        'loanRecords': 'loanRecords',
        'loanStatistics': 'loanStatistics',
        'auditInformation': 'auditInformation',
        "machineReview": 'machineReview',
        'querySharedLibrary': 'querySharedLibrary',
        'dtOldSource': 'dtOldSource',
        'repaymentCode': 'repaymentCode',
        'yinniRepayment': 'yinniRepayment',
        'postInfo': 'postInfo',
        'phoneBillRecord':'phoneBillRecord',
      }
    },
    nav_height() {
      return {
        maxHeight: (document.body.clientHeight - this.tabs_top) * 0.8 + 'px'
      }
    },
  },
  beforeDestroy() {
    window.removeEventListener('scroll', this.onScroll)
  }
}
</script>

<style lang="less" scoped>
::v-deep .el-menu-item.is-active {
  background-color: #ffffff !important;
}

::v-deep .el-collapse-item__header {
  background-color: #ffedb3 !important;
}

.tabsActive {
  background-color: #ff8a00;
  color: #FF8A00 !important;
}

::v-deep .hide .el-upload--picture-card {
  display: none;
}

.avatar {
  width: 178px;
  height: 178px;
  display: block;
}

.table_list {
  box-sizing: border-box;
  text-align: center;
  position: relative;
  font-size: 16px;
  cursor: pointer;
  color: #5F5F5F;
  padding: 20px;

  .tabs_silde {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    //background-color: #ff8a00;
  }
}

.navigation_bar {
  position: fixed;
  right: 16px;
  width: 220px;
  z-index: 1500;

  .nav_list {
    list-style: none;
    margin: 0;
    position: relative;
    padding-left: 10px;

    .nav_fixing {
      height: 20px;
      width: 20px;
      border-radius: 50%;
      background-color: #F1B901;
      position: absolute;
      left: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 10;
      transition: .2s top ease-in;
    }

    .nav_list_item {
      height: 30px;
      line-height: 30px;
      cursor: pointer;

      .item_text {
        margin-left: 15px;
      }
    }
  }

  .nav_list_item::before {
    content: "";
    height: 30px;
    width: 1px;
    background-color: #F1B901;
    position: absolute;
  }
}

.collapse {
  margin: 10px 230px 50px 0;
}

.collapse_title {
  margin-left: 15px;
  font-size: 18px;
}

.collapse_content {
  box-sizing: border-box;
}

::v-deep .el-collapse-item__content {
  padding-bottom: 0px;
}
</style>
